package kr.re.etri.snsenabler.client.auth;

import kr.re.etri.snsenabler.shared.Data;
import kr.re.etri.snsenabler.shared.SocialServiceProvider;

import com.sencha.gxt.widget.core.client.Dialog;

public abstract class AbstractAuthorizationDialog {

	protected Data loginData;
	protected Data socialServiceData;
	protected final SocialServiceProvider socialServiceProvider;

	public static AbstractAuthorizationDialog createDialog(Data loginData, SocialServiceProvider provider) {
		switch (provider) {
			case DaumBlog:
				return new DaumBlogAuthorizationDialog(loginData, provider);
			case DaumCafe:
				return new DaumCafeAuthorizationDialog(loginData, provider);
			case Naver:
				return new NaverAuthorizationDialog(loginData, provider);
			case Twitter:
				return new TwitterAuthorizationDialog(loginData, provider);
			case Facebook:
				return new FacebookAuthorizationDialog(loginData, provider);
			default:
				return null;
		}
	}

	public AbstractAuthorizationDialog(Data loginData, SocialServiceProvider socialServiceProvider) {
		super();
		this.loginData = loginData;
		this.socialServiceProvider = socialServiceProvider;
	}

	public abstract Dialog getDialog();

	public Data getSocialServiceData() {
		return socialServiceData;
	}
}
